using System.Reflection;

namespace Thunder.Irc.Parser
{
    /// <summary>
    /// Extension menthods for the Assembly class
    /// </summary>
    public static class AssemblyExtensions
    {
        /// <summary>
        /// Gets the assembly product.
        /// </summary>
        /// <value>The assembly product.</value>
        public static string AssemblyProduct(this Assembly assembly)
        {
            // Get all Product attributes on this assembly
            object[] attributes = assembly.GetCustomAttributes(typeof (AssemblyProductAttribute), false);

            return attributes.Length == 0 ? "" : ((AssemblyProductAttribute)attributes[0]).Product;
        }
    }
}